<template>
  <t-image :src="src" :lazy="true" shape="round" class="steve-image">
    <template #error>
      <t-tooltip :content="src ? src : '未设置图片'">
        <div class="steve-image__error">
          <div class="steve-image__error__icon">
            <span>图片</span>
          </div>
          <div class="steve-image__error__info">加载失败</div>
        </div>
      </t-tooltip>
    </template>
  </t-image>
</template>

<script setup lang="ts">
import SteveIcon from '@/components/steveIcon/index.vue';

const props = defineProps({
  // 图片地址
  src: {
    type: String,
    default: '',
  },
});
</script>

<style lang="less" scoped>
.steve-image {
  background: transparent;

  :deep(.t-image) {
    &__loading,
    &__error {
      position: static;
    }
  }

  &__error {
    display: flex;
    flex-direction: column;
    align-items: center;

    &__info {
      font-size: var(--td-font-size-link-small);
    }
  }
}
</style>
